package assets
{
	import flash.events.Event;
	import flash.events.MouseEvent;
	
	import model.AppModel;

	public class Card extends BasicCard
	{
		//properties
		private var cardName:String;
		private var appModel:AppModel;
		public var turnd:Boolean = false;
		
		//constructor
		public function Card(name:String)
		{
			this.appModel = AppModel.getInstance();
			
			//trace("constructor [Card]");
			this.buttonMode = true;
			this.cardName = name;
			this.txt.visible = false;
			this.txt.text = cardName;
			this.name = cardName;
			
			this.addEventListener(MouseEvent.CLICK, cardClickHandler);
		}
		
		private function cardClickHandler(e:Event):void{
			turnd = true;
			this.txt.visible = true;
			this.buttonMode = false;
			this.removeEventListener(MouseEvent.CLICK, cardClickHandler);
			appModel.clickedCard = this;
		}
	}
}